<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <h1>事件是文档或浏览器窗口中发生的特定瞬间，例如用户的点击、键盘的按下、页面的加载等</h1>

    <button onclick="fucn()">按钮</button>
    <input id="input1" type="text" onfocus="myOnfocus()" onblur="myOnblur()">

    <script>
        function fucn() {
            alert("hello")
        }
        console.log('myOnfocus------')
        function myOnfocus() {
            console.log('myOnfocus() 获取焦点了')
        }

        function myOnblur() {
            let input1 = document.getElementById('input1').value;
            console.log(typeof input1) // string
            if (input1.length < 3) {
                // alert('请输入3个以上的字符')
                console.log('请输入3个以上的字符')
                return
            }
            console.log('muOnblur() 失去了焦点')
        }
    </script>
</body>

</html>